/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */
package model.entities;

import java.io.Serializable;
import java.util.Collection;
import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.FetchType;
import javax.persistence.GeneratedValue;
import javax.persistence.Id;
import javax.persistence.NamedQueries;
import javax.persistence.NamedQuery;
import javax.persistence.OneToMany;
import javax.persistence.SequenceGenerator;
import javax.persistence.Table;
import javax.validation.constraints.Size;

/**
 *
 * @author Samy.A.Omar
 */
@Entity
@Table(name = "TICKET_TYPES")
@NamedQueries({
    @NamedQuery(name = "TicketType.findAll", query = "SELECT t FROM TicketType t"),
    @NamedQuery(name = "TicketType.findByTicketTypeId", query = "SELECT t FROM TicketType t WHERE t.ticketTypeId = :ticketTypeId"),
    @NamedQuery(name = "TicketType.findByTicketTypeName", query = "SELECT t FROM TicketType t WHERE t.ticketTypeName = :ticketTypeName")})
public class TicketType implements Serializable {
	
    private static final long serialVersionUID = 1L;
    // @Max(value=?)  @Min(value=?)//if you know range of your decimal fields consider using these annotations to enforce field validation
    

    @Id
    @Column(name = "TICKET_TYPE_ID")
    @SequenceGenerator(name="TicketType_Gen", sequenceName="TICKET_TYPE_SEQ") 
    @GeneratedValue(generator="TicketType_Gen")
    private Integer ticketTypeId;
    
    
    @Size(max = 20)
    @Column(name = "TICKET_TYPE_NAME")
    private String ticketTypeName;
    
    
    @OneToMany(mappedBy = "ticketType", fetch = FetchType.LAZY)
    private Collection<Ticket> ticketCollection;
    
    

    public TicketType() {
    }

   
    

    public Integer getTicketTypeId() {
		return ticketTypeId;
	}




	public void setTicketTypeId(Integer ticketTypeId) {
		this.ticketTypeId = ticketTypeId;
	}




	public String getTicketTypeName() {
        return ticketTypeName;
    }

    public void setTicketTypeName(String ticketTypeName) {
        this.ticketTypeName = ticketTypeName;
    }

    public Collection<Ticket> getTicketCollection() {
        return ticketCollection;
    }

    public void setTicketCollection(Collection<Ticket> ticketCollection) {
        this.ticketCollection = ticketCollection;
    }

    
    
    
    @Override
    public int hashCode() {
        int hash = 0;
        hash += (ticketTypeId != null ? ticketTypeId.hashCode() : 0);
        return hash;
    }

    @Override
    public boolean equals(Object object) {
        // TODO: Warning - this method won't work in the case the id fields are not set
        if (!(object instanceof TicketType)) {
            return false;
        }
        TicketType other = (TicketType) object;
        if ((this.ticketTypeId == null && other.ticketTypeId != null) || (this.ticketTypeId != null && !this.ticketTypeId.equals(other.ticketTypeId))) {
            return false;
        }
        return true;
    }

    @Override
    public String toString() {
        return "model.entities.TicketType[ ticketTypeId=" + ticketTypeId + " ]";
    }
    
}
